#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<stack>
#include<vector>
#include<string>
using namespace std;
class Solution {
public:
    int evalRPN(vector<string>& tokens) {
        stack<int> a;
        for (int i = 0; i < tokens.size(); i++) {
            string c = tokens[i];
            if (c == "+") {
                int n = a.top();
                a.pop();
                n += a.top();
                a.pop();
                a.push(n);
            }
            else if (c == "-") {
                int n = a.top();
                a.pop();
                n -= a.top();
                a.pop();
                a.push(n);
            }
            else if (c == "*") {
                int n = a.top();
                a.pop();
                n *= a.top();
                a.pop();
                a.push(n);
            }
            else if (c == "/") {
                int n = a.top();
                a.pop();
                n = a.top() / n;
                a.pop();
                a.push(n);
            }
            else {
                int i = 0;
                int falg = 1;
                int k = 0;
                if (c[0] == '-') {
                    falg = -1;
                    i++;
                }
                for (; i < c.size(); i++) {

                    k *= 10;
                    k += c[i] - '0';
                }
                a.push(k * falg);
            }
        }
        // while (!a.empty())
        //{
        //     cout << a.top() << ' ';
        //     a.pop();
        // }
        return a.top();
    }
};

int main()
{
    vector<string> aa = {"4","3","-"};
    Solution a;
    int c = a.evalRPN(aa);
    cout << c << endl;
	return 0;
}